package com.atguigu.gmall.order.service;


import com.atguigu.gmall.model.cart.CartInfo;
import com.atguigu.gmall.order.mapper.CartInfoMapper;
import com.atguigu.gmall.order.mapper.OrderInfoMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;


import java.util.List;
@Service
public class OrderInfoSyncServiceImpl implements OrderInfoSyncService {
    @Autowired
    private CartInfoMapper cartInfoMapper;

    //异步删除DB
    @Override
    @Async
    public void deleteOrderInfo(Long userId, List<Long> skuIdList) {
        cartInfoMapper.delete(new QueryWrapper<CartInfo>().eq("user_id",userId).
                in("sku_id",skuIdList));
    }
}
